﻿<?php

require_once dirname(__FILE__).'/AdminOnlyPageHeader.php';
require_once dirname(__FILE__).'/../config/config.php';

$data = new stdClass();
$data->operation = $_POST['mode'];
$data->eMail = $_POST['Email'];
$data->Name = $_POST['Name'];
$data->IsActive = isset($_POST['IsActive']) && (strcmp($_POST['IsActive'], "1") == 0);
$data->IsAdmin = isset($_POST['IsAdmin']) && (strcmp($_POST['IsAdmin'], "1") == 0);
$data->AllRoles = $_POST['AllRoles'];

$rsp = UpdateUserData($data);

$s1 = $rsp ? "Error" : "OK";
$result = array("operation" => $data->operation, "status" => $s1, "errorMsg" => $rsp,
    "Email" => $data->eMail, "Name" => $data->Name, "IsActive" => $data->IsActive,
    "IsAdmin" => $data->IsAdmin, "AllRoles" => $data->AllRoles
);
echo json_encode($result);
exit;
?>
